﻿using BaoVeThanhDia.Buttons;
using BaoVeThanhDia.GamePlay.Monsters;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using System.Collections.Generic;
using System.Text;

namespace BaoVeThanhDia.Introduction
{
    class MonsterInfo
    {
        StringBuilder name;
        int TypeLinh;// loại lính
        List<Button> buttons;
        Monster monster;
        Vector2 Position;
        SpriteFont font;
        bool isTouched;
        public MonsterInfo(int type)
        {
            TypeLinh = type;
            setName();
            buttons = new List<Button>();
            buttons.Add(new Button("khung", "images/Introduction/white_board", new Vector2(25 + 230 * (TypeLinh - 1), 30), new Vector2(0, 0), new Vector2(176, 277), 0.8f));
            buttons.Add(new Button("", "images/Introduction/ribbon", new Vector2(230 * (TypeLinh - 1), 25), new Vector2(0, 0), new Vector2(355, 90), 0.57f));
            monster = new Monster(TypeLinh, new Vector2(0, 0), 0,0);
            Position = new Vector2(20 + 230 * (TypeLinh - 1), 30);
        }
        public void Load(ContentManager cont)
        {
            foreach (Button button in buttons)
            {
                button.Load(cont);
            }
            monster.Load(cont);
            font = cont.Load<SpriteFont>("fonts/IntroFont");
        }
        public void Draw(SpriteBatch sprite, Vector2 Dolech)
        {
            foreach (Button button in buttons)
            {
                button.Draw(sprite, Dolech);
            }
            sprite.DrawString(font, name, new Vector2(82 + 230 * (TypeLinh - 1), 40) + new Vector2(-4.4f, 0) * name.Length + Dolech, Color.White, 0, Vector2.Zero, 1.0f, SpriteEffects.None, 0);
            monster.OptionDraw(sprite, new Vector2(33 + 230 * (TypeLinh - 1), 80), Dolech, isTouched ? 1.0f + 0.01f * TypeLinh : 0.7f, isTouched);
        }
        public void setName()
        {
            switch (TypeLinh)
            {
                case 1: name = new StringBuilder("Sâu Địa Ngục");
                    break;
                case 2: name = new StringBuilder("Đồ Tể");
                    break;
                case 3: name = new StringBuilder("Lâu La");
                    break;
                case 4: name = new StringBuilder("Rồng Cổ Đại");
                    break;
                case 5: name = new StringBuilder("Kẻ Vận Chuyển");
                    break;
                case 6: name = new StringBuilder("Kẻ Gọi Hồn");
                    break;
                case 7: name = new StringBuilder("Chiến Binh Bóng Đêm");
                    break;
                case 8: name = new StringBuilder("Tiểu Quỷ");
                    break;
                case 9: name = new StringBuilder("Kẻ Gieo Ác Mộng");
                    break;
                case 10: name = new StringBuilder("Rồng Ăn Thịt");
                    break;
                case 11: name = new StringBuilder("Hồn Ma");
                    break;
                case 12: name = new StringBuilder("Kẻ Gác Cổng Địa Ngục");
                    break;
                case 13: name = new StringBuilder("Phù Thủy Bóng Đêm");
                    break;
                case 14: name = new StringBuilder("Rồng Bạo Chúa");
                    break;
                default: name = new StringBuilder("Ác Quỷ Bất Diệt");
                    break;
            }

        }
        public bool isTouch(Vector2 touch, Vector2 Dolech)
        {
            isTouched = false;
            touch -= Dolech;
            if (buttons[0].isTouch(touch))
            {
                buttons[0].setTouch(false);
                isTouched = true;
                return true;
            }
            return false;
        }
        public int getTypeLinh() { return TypeLinh; }
    }
}
